<?php
/**
物流报警
**/

namespace Apps\Controller;
use Think\Controller;
use Think\Model;

class LogisticalarmController extends Controller {

    /**
    */
    public function index(){
      $Model = new Model();
      if(IS_POST){
        //提交查询信息
        $startTime = I('startTime');
        $startTimeStamp = strtotime($startTime);// 10位时间戳
        $endTimeStamp = NOW_TIME + 2 * 60 * 60; //after 2 hour
        $sql = "SELECT c.areaName,COUNT(1) cnt FROM gr_ec.gr_final_order a,gr_ec.gr_final_order_group b,gr_ec.gr_area c WHERE a.groupNo = b.groupNo AND a.areaId = c.id AND a.status IN( 4000) AND b.deliveryTime >= $startTimeStamp AND b.deliveryTime <= $endTimeStamp GROUP BY c.areaName ORDER BY c.areaName";
        $result = $Model->query($sql);
        \Think\Log::record('LogisticalarmController SQL:'.$sql);
        $this->assign('result',$result);
        $this->display('result');
      }else{
        //显示默认页面
        $this->display();
      }


    }
  }
